package com.adv.ems.model.vo;

import com.adv.ems.db.entity.ItemInfoDO;
import com.adv.ems.db.entity.ItemTwoInfoDO;
import com.adv.ems.utils.EmsUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
public class BaseTwoItemVO {
    private List<Info> list;

    public BaseTwoItemVO() {
        this.list = new ArrayList<Info>();
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Info {
        private Long id;
        private Long itemOneId;
        private String name;
        private String code;

        public Info(ItemTwoInfoDO twoItem, String acceptLanguage) {
            this.id = twoItem.getId();
            this.itemOneId = twoItem.getItemOneId();
            this.name = EmsUtil.multilingual(twoItem.getNameInfo(), acceptLanguage);
            this.code = twoItem.getCode();
        }
    }
}
